package com.app.micaihu.view.lunch.dialog;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.app.micaihu.R;
import com.app.micaihu.base.BaseOldDialog;
import com.blankj.utilcode.util.ClickUtils;

public class ClosePermissionDialog extends BaseOldDialog {

    public static ClosePermissionDialog getCloseDialog() {
        return new ClosePermissionDialog();
    }

    private TextView tvCancel, tvOk;
    private OnOpenClick onOpenClick;

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_close_permission;
    }

    @Override
    protected void init(Bundle bundle) {
        tvCancel = thisView.findViewById(R.id.tvCancel);
        tvOk = thisView.findViewById(R.id.tvOk);

    }

    @Override
    protected void setData() {
    }

    @Override
    protected void setListener() {
        tvCancel.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
            @Override
            public void onDebouncingClick(View v) {
                if (onOpenClick != null) {
                    ClosePermissionDialog.this.dismiss();
                    onOpenClick.onCancelClick();
                }
            }
        });
        tvOk.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
            @Override
            public void onDebouncingClick(View v) {
                if (onOpenClick != null) {
                    onOpenClick.onOkClick();
                }
            }
        });
    }

    public interface OnOpenClick {
        void onCancelClick();

        void onOkClick();
    }

    public void setOnOpenClick(OnOpenClick onOpenClick) {
        this.onOpenClick = onOpenClick;
    }
}
